// import PicKer from '../../components/Pickers/PicKer'

// const Pick=()=>{
//     return (
//         <div>
//             <PicKer />
//         </div>
//     )
// }

// export default Pick


import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { setName, setInfo, selectName, selectInfo } from '../../store/slicers/studentSlice'

const App = () => {
	// 获取student中的name值
    // const name = useSelector(state => state.student.name)
    
    // 简化写法
    const name = useSelector(selectName) 
    const info = useSelector(selectInfo)

    const dispatch = useDispatch()
    
    const setNameHandler = () => {
        dispatch(setName('哈哈'))
    }

    const setInfoHandler = () => {
        dispatch(setInfo({sex: '女', age: 18}))
    }

    return (
        <div>
            <p>
                {name} ---
                {info.sex} ---
                {info.age} ---
            </p>
            <button onClick={setNameHandler}>修改name</button>
            <button onClick={setInfoHandler}>修改info</button>
        </div>
    )
}

export default App;